.class public Lcom/qiniu/resumableio/PutExtra;
.super Ljava/lang/Object;
.source "PutExtra.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/qiniu/resumableio/PutExtra$INotify;
    }
.end annotation


# instance fields
.field public mimeType:Ljava/lang/String;

.field public notify:Lcom/qiniu/resumableio/PutExtra$INotify;

.field public params:Ljava/util/Map;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation
.end field

.field public processes:[Lcom/qiniu/resumableio/PutRet;

.field totalSize:J


# direct methods
.method public constructor <init>()V
    .registers 1

    .prologue
    .line 19
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public constructor <init>(Lorg/json/JSONObject;)V
    .registers 10
    .param p1, "obj"    # Lorg/json/JSONObject;

    .prologue
    .line 20
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 21
    const-string v5, "mimeType"

    const-string v6, ""

    invoke-virtual {p1, v5, v6}, Lorg/json/JSONObject;->optString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    iput-object v5, p0, Lcom/qiniu/resumableio/PutExtra;->mimeType:Ljava/lang/String;

    .line 22
    const-string v5, "processes"

    invoke-virtual {p1, v5}, Lorg/json/JSONObject;->optJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v4

    .line 23
    .local v4, "procs":Lorg/json/JSONArray;
    invoke-virtual {v4}, Lorg/json/JSONArray;->length()I

    move-result v5

    new-array v5, v5, [Lcom/qiniu/resumableio/PutRet;

    iput-object v5, p0, Lcom/qiniu/resumableio/PutExtra;->processes:[Lcom/qiniu/resumableio/PutRet;

    .line 24
    const/4 v0, 0x0

    .local v0, "i":I
    :goto_1c
    invoke-virtual {v4}, Lorg/json/JSONArray;->length()I

    move-result v5

    if-ge v0, v5, :cond_32

    .line 25
    iget-object v5, p0, Lcom/qiniu/resumableio/PutExtra;->processes:[Lcom/qiniu/resumableio/PutRet;

    new-instance v6, Lcom/qiniu/resumableio/PutRet;

    invoke-virtual {v4, v0}, Lorg/json/JSONArray;->optJSONObject(I)Lorg/json/JSONObject;

    move-result-object v7

    invoke-direct {v6, v7}, Lcom/qiniu/resumableio/PutRet;-><init>(Lorg/json/JSONObject;)V

    aput-object v6, v5, v0

    .line 24
    add-int/lit8 v0, v0, 0x1

    goto :goto_1c

    .line 27
    :cond_32
    new-instance v5, Ljava/util/HashMap;

    invoke-direct {v5}, Ljava/util/HashMap;-><init>()V

    iput-object v5, p0, Lcom/qiniu/resumableio/PutExtra;->params:Ljava/util/Map;

    .line 28
    const-string v5, "params"

    invoke-virtual {p1, v5}, Lorg/json/JSONObject;->optJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object v3

    .line 29
    .local v3, "paramsJson":Lorg/json/JSONObject;
    invoke-virtual {v3}, Lorg/json/JSONObject;->keys()Ljava/util/Iterator;

    move-result-object v1

    .local v1, "iter":Ljava/util/Iterator;, "Ljava/util/Iterator<*>;"
    :goto_43
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v5

    if-eqz v5, :cond_59

    .line 30
    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Ljava/lang/String;

    .line 31
    .local v2, "key":Ljava/lang/String;
    iget-object v5, p0, Lcom/qiniu/resumableio/PutExtra;->params:Ljava/util/Map;

    invoke-virtual {v3, v2}, Lorg/json/JSONObject;->optString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v6

    invoke-interface {v5, v2, v6}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    goto :goto_43

    .line 33
    .end local v2    # "key":Ljava/lang/String;
    :cond_59
    return-void
.end method


# virtual methods
.method public isFinishAll()Z
    .registers 11

    .prologue
    const/4 v3, 0x0

    .line 36
    iget-wide v4, p0, Lcom/qiniu/resumableio/PutExtra;->totalSize:J

    const-wide/16 v6, 0x0

    cmp-long v4, v4, v6

    if-gtz v4, :cond_a

    .line 41
    :cond_9
    :goto_9
    return v3

    .line 37
    :cond_a
    const-wide/16 v0, 0x0

    .line 38
    .local v0, "currentSize":J
    iget-object v5, p0, Lcom/qiniu/resumableio/PutExtra;->processes:[Lcom/qiniu/resumableio/PutRet;

    array-length v6, v5

    move v4, v3

    :goto_10
    if-ge v4, v6, :cond_1b

    aget-object v2, v5, v4

    .line 39
    .local v2, "pr":Lcom/qiniu/resumableio/PutRet;
    iget v7, v2, Lcom/qiniu/resumableio/PutRet;->offset:I

    int-to-long v8, v7

    add-long/2addr v0, v8

    .line 38
    add-int/lit8 v4, v4, 0x1

    goto :goto_10

    .line 41
    .end local v2    # "pr":Lcom/qiniu/resumableio/PutRet;
    :cond_1b
    iget-wide v4, p0, Lcom/qiniu/resumableio/PutExtra;->totalSize:J

    cmp-long v4, v0, v4

    if-ltz v4, :cond_9

    const/4 v3, 0x1

    goto :goto_9
.end method

.method public toJSON()Lorg/json/JSONObject;
    .registers 8
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/json/JSONException;
        }
    .end annotation

    .prologue
    .line 45
    new-instance v0, Lorg/json/JSONObject;

    invoke-direct {v0}, Lorg/json/JSONObject;-><init>()V

    .line 46
    .local v0, "json":Lorg/json/JSONObject;
    new-instance v2, Lorg/json/JSONArray;

    invoke-direct {v2}, Lorg/json/JSONArray;-><init>()V

    .line 47
    .local v2, "process":Lorg/json/JSONArray;
    iget-object v4, p0, Lcom/qiniu/resumableio/PutExtra;->processes:[Lcom/qiniu/resumableio/PutRet;

    array-length v5, v4

    const/4 v3, 0x0

    :goto_e
    if-ge v3, v5, :cond_1c

    aget-object v1, v4, v3

    .line 48
    .local v1, "p":Lcom/qiniu/resumableio/PutRet;
    invoke-virtual {v1}, Lcom/qiniu/resumableio/PutRet;->toJSON()Lorg/json/JSONObject;

    move-result-object v6

    invoke-virtual {v2, v6}, Lorg/json/JSONArray;->put(Ljava/lang/Object;)Lorg/json/JSONArray;

    .line 47
    add-int/lit8 v3, v3, 0x1

    goto :goto_e

    .line 50
    .end local v1    # "p":Lcom/qiniu/resumableio/PutRet;
    :cond_1c
    const-string v3, "processes"

    invoke-virtual {v0, v3, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 51
    const-string v3, "mimeType"

    iget-object v4, p0, Lcom/qiniu/resumableio/PutExtra;->mimeType:Ljava/lang/String;

    invoke-virtual {v0, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 52
    iget-object v3, p0, Lcom/qiniu/resumableio/PutExtra;->params:Ljava/util/Map;

    if-eqz v3, :cond_38

    const-string v3, "params"

    new-instance v4, Lorg/json/JSONObject;

    iget-object v5, p0, Lcom/qiniu/resumableio/PutExtra;->params:Ljava/util/Map;

    invoke-direct {v4, v5}, Lorg/json/JSONObject;-><init>(Ljava/util/Map;)V

    invoke-virtual {v0, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 53
    :cond_38
    return-object v0
.end method
